Total Reuse in Descendants percentage (TRDp)

Description:

Reuse in Descendants

The RD Metric

Definition 1 (Reuse in Descendant-class - RD) The RD metric between a class C and one of its descendant classes D is formally expressed as:

i= nC
RD(C; D) = RDD(mi;D) / nC
i = 1

where mi (i = 1; n C) represent the usable class members of C.

Explanations The RD metric quantities the totalized reuse of all the members of a class C, in one of its descendant classes. The degree to which a particular member is reused in a descendant class is variable. We consider that the way this reuse degree is calculated depends on the goals of the measurement. Analogous to RA we decided to parameterize the metric with a family of metrics called Reuse Degree in Descendant-class (RDD), that quantities this reuse degree. A description of this family of metrics is presented below.

The RDD Metrics

Definition 2 (Reuse Degree in Descendant Class) A function expressing the measure of reuse of a class member mC class C in a descendent class D is called Reuse Degree of mC in Descendant-class D.

RDD : SMCX SDCC-- [0; 1]

where C is the set of all members in class C and SDCC is the set of descendant classes D for class C.

Percentage RDD - RDDperc The Percentage Reuse Degree in Descendant Class is defined as:

i = nD
RDDperc(mC; D) = uses(mc;mthD(i))/nD
i = 1

where nD is the number of methods in class D. Function uses is defined as:

uses(mA; mthC) = { 1 if class member mA is used in method mthC
0 if not

The Total RD Metric - TRD

In the previous sections we defined the RD metric with two parameters: a particular class and a descendant of that class. In the same way we defined TRA we also considered that it is necessary to define a metric that expresses the total value for the reuse of a class by all its descendants.

We considered following two viewpoints for the interpretation of this metric.

  1. Maintainability. A high TRD value for a class indicates that a change in that class has a high impact on the underlying class-hierarchy, i.e. its descendants.
  2. Degree of Member Reuse. A high TRD for a class indicates that the very most of its members are reused in the sub-classes.

In proposing these two viewpoints, we observed that because their focus is strongly different it would be quite impossible to have a single definition for TRD. So we proposed a definition for each one of the two viewpoints:

Definition 3 (Descendants-based Definition of TRD) The Total Reuse in Descendants metric for a class C is defined as the sum of all RD values between class C and its descendants. This can be formally expressed as:

i = nD
TRD(C) = RD(C;Di)
i = 1

where nD represents the number of descendant-classes for class C, and Di is the iterator of its descendants.

Source: Ing. Radu Marinescu. An Object Oriented Metrics Suite on Coupling. Universitatea "Politehnica" Timisoara, Facultatea de Automatica si Calculatoare, Departamentul de Calculatoare si Inginerie Software. September, 1998.